<template>
    <div class="user_member">
        <wrapper-content :pageTitle="pagetitle">
            <div class="data-content">
                <div class="right">
                    <Button type="ghost" shape="circle" icon="arrow-return-left"
                            @click="this.$router.push({path:'/content/list'});">
                        返回
                    </Button>
                </div>
                <Form ref="addcontent" :model="formValidate" label-position="right" :label-width="100">
                    <FormItem label="类型：" prop="type" style="width: 250px">
                        <Select v-model="formValidate.type" placeholder="">
                            <Option value="member">会员公告</Option>
                            <Option value="agent">代理公告</Option>
                        </Select>
                    </FormItem>
                    <FormItem label="标题：" prop="title" style="width: 500px">
                        <Input v-model="formValidate.title" />
                    </FormItem>
                    <Form-item label="正文：" prop="text" class="edit">
                        <editor ref="vueWangeditor_add" @load="editorLoad" @change="editorChange"
                                :width="editor_style.width" :height="editor_style.height"
                                :uploadImgUrl="uploadImgUrl" :uploadParams="uploadParams"
                                :uploadHeaders="uploadHeaders" :menus="menus"
                                id="editor"></editor>
                    </Form-item>
                    <FormItem>
                        <Button type="primary" @click="handleSubmit('addcontent')">确定</Button>
                    </FormItem>
                </Form>
            </div>
        </wrapper-content>

    </div>
</template>
<style>
    .ivu-form-item-content.edit>div{
        height: 300px;
    }
</style>
<script>
    import WrapperContent from '../../components/wrapper-content.vue'
    import {getUserList, getUser, getLevelList, getPositionList,doUserInfo,delUser,changeUserState} from "@/api/user";
    import * as utils from '../../assets/js/utils'
    import $ from 'jquery'
    import _ from 'lodash'
    import editor from '../../components/editor_2.0.vue'

    export default {
        components: {
            WrapperContent,editor
        },
        data() {
            return {
                self: this,
                formValidate: {
                    type:'member',
                    title:'',
                    text:'',
                },
                pagetitle:'新增公告',
                editor_style: {
                    width: 'auto',
                    height: '250'
                },
                uploadImgUrl: utils.getUploadUrl('Project_Task.uploadContentImg'),
                uploadHeaders: {
                    token: utils.getStore('token')
                },
                uploadParams: {
                    task_id: 0
                },
                menus: [
                    'head',	// 标题
                    'bold',	// 粗体
                    'italic',	// 斜体
                    'aligncenter',	// 居中
                    'img',	// 图片
                    'link',	// 链接
                    'unorderlist',	// 无序列表
                    'orderlist',	// 有序列表
                    'quote',	// 引用
                    'table',	// 表格
                    '|',
                    'fullscreen'	// 全屏
                ],
            }
        },

        created: function () {
            this.loading = false ;
        },
        methods: {
            handleSubmit (name) {
                this.$Message.success('Success!');

            },
            editorLoad(originalName, resultText) {
                // resultText 服务器端返回的text
                // originalName 上传文件名
                this.$refs.vueWangeditor.insertImg(resultText)
            },
            editorChange(a) {
//                console.log(a)
            },
        }
    }
</script>

















































